words = ("暴力", "非法", "恐怖")
s = "某处发生了一起严重的暴力事件，已有当地一恐怖组织声称对此事负责"
for word in words:
    if word in s:
        s = s.replace(word, "***")
print(s)
